package flink.function;

import org.apache.flink.api.common.functions.FilterFunction;

import com.alibaba.fastjson.JSONObject;

/**
 * @author ：Jason
 * @date ：Created in 2023/4/30 12:48 PM
 * @description：过滤 Jsonobject 包含指定的 key,value 数据
 * @modified By：
 * @version: 1.0
 */
public class FilterVlueEqualFunction implements FilterFunction<JSONObject> {
    private final String key;
    private final String value;

    public FilterVlueEqualFunction(String key, String value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public boolean filter(JSONObject element) throws Exception {
        return element.getString(key).equals(this.value);
    }
}
